Select = function() {
};
Select.Create = function(c) {
	if (c) {
		var s = $c("select");
		s.id = c.id;
		s.name = c.name;
		s.className = c.className;
		if (c.data) {
			for (var i = 0; i < c.data.length; i++) {
				var option = new Option(c.data[i].text, c.data[i].value);
				s.options.add(option);
			}
		} else {
			Ajax.request({
				method : c.method,
				url : c.url,
				success : function(response) {
					var data = eval('(' + response.responseText + ')');
					for (var i = 0; i < data.length; i++) {
						var option = new Option(data[i].text, data[i].value);
						s.options.add(option);
					}
				},
				failure:function(){
					alert("Loading failure");
				}
			});

		}
		if (c.onchange)
			s.onchange = c.onchange;
		return s;
	}
	return null;
}
Select.Demo = function() {
	return Select.Create({
		id : "test",
		name : "test",
		url : 'private/test.jsp',
		method : 'post',
		onchange : function() {
			window.location.href="unReadMessage.do?method=historyMessages&page=1&type="+this.value;
		}
	});
}
function $c(element) {
	return document.createElement(element);
}
function $g(id) {
	return document.getElementById(id);
}
